package com.seveneight.baijiesteward.adapter;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.seveneight.baijiesteward.R;
import com.seveneight.baijiesteward.bean.UpdateBean;
import com.seveneight.baijiesteward.http.AppConfig;
import com.seveneight.baijiesteward.ui.main.fragment.MainFragment;
import com.seveneight.baijiesteward.ui.user.activity.ManagerCardActivity;
import com.seveneight.baijiesteward.ui.user.fragment.ManagercardFragment;
import com.seveneight.baijiesteward.utils.WindowUtil;

/**
 * Created by user1 on 2018/3/26.
 */

public class UpdateAdapter extends ListBaseAdapter<UpdateBean> {

    private Activity activity;

    public UpdateAdapter(Activity context) {
        super(context);
        this.activity=context;
    }

    @Override
    public int getLayoutId() {
        return R.layout.item_updaterank;
    }

    @Override
    public void onBindItemHolder(SuperViewHolder holder, int position) {
        TextView tv_nowrank = holder.getView(R.id.tv_nowrank);
        TextView tv_nextrank = holder.getView(R.id.tv_nextrank);
        TextView tv_updateprice = holder.getView(R.id.tv_updateprice);
        TextView tv_sumbit = holder.getView(R.id.tv_sumbit);
        UpdateBean updateBean=mDataList.get(position);
        tv_nowrank.setText(updateBean.getNowRankName());
        tv_nextrank.setText(updateBean.getNextRankName());
        tv_updateprice.setText("付费"+updateBean.getUpDatePrice()+"元");
        tv_sumbit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent=new Intent(activity,ManagerCardActivity.class);
                Bundle bundle=new Bundle();
                bundle.putInt("type",1);
                bundle.putString("UpGradeRankID",updateBean.getNextRankID());
                intent.putExtras(bundle);
                activity.startActivityForResult(intent, AppConfig.REQUEST_CODE_0);
            }
        });
    }
}
